package com.itheima.dubbo.service;

import com.itheima.dubbo.UserInterface;
import com.itheima.dubbo.pojo.User;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.rpc.RpcContext;

@DubboService
public class UserServiceImpl implements UserInterface {

    @Override
    public String hello(String username) {
        System.out.println("UserServiceImpl......");
        return "Hello dubbo username:"+username;
    }

    @Override
    public User findOne(Long id) {
        User user = new User();
        user.setUsername("张三");
        user.setId(id);
        user.setAge(18);

        String company = RpcContext.getContext().getAttachment("company");
        System.out.println(company);
        return user;
    }


}
